home *** CD-ROM | disk | FTP | other *** search
- Module MainModule
- Sub Main()
- ' Run one of the Textxxxx procedures below by uncommenting only one statement
-
- 'TestExternalAssembly()
- 'TestApplicationSettings()
-
- ' You need these statements when running inside Visual Studio, so that
- ' the Console window doesn't disappear
- Console.WriteLine("")
- Console.WriteLine(">>> Press Enter to terminate the program <<<")
- Console.ReadLine()
- End Sub
-
- ' this procedure attempts to run a method of an external assembly
-
- ' IMPORTANT: it requires that you reference the TestAssembly.Dll
- ' project, which will cause the DLL to be copied in the Bin directory
- ' of the current project
-
- Sub TestExternalAssembly()
- Dim vi As New TestAssembly.VersionInfo()
- Console.WriteLine(vi.Description)
- End Sub
-
- ' this procedure reads all application's settings
-
- ' IMPORTANT: This procedure works with the AssemblyDemo.Exe.Config file
- ' provided in this project's directory. This file must be copied in the
- ' Bin subdirectory
-
- Sub TestApplicationSettings()
- Dim colValues As System.Collections.Specialized.NameValueCollection
- Dim key As String
-
- ' retrieve all values as a IDictionary
- colValues = Configuration.ConfigurationSettings.AppSettings()
-
- ' print all values
- For Each key In colValues.AllKeys
- Console.WriteLine("Key=""{0}"" Value=""{1}""", key, colValues.Get(key))
- Next
-
- ' an example of casting to an integer variable
- Dim timeout As Integer = CInt(colValues("Timeout"))
-
- End Sub
-
- End Module
-